return
, and
/or
¶
return
¶
blue_trail.py
¶
Move Bit along the blue trail. Stop when the blue stops, or when Bit is blocked in front.
🖌 and
¶
In [1]:
print(True and True)
True
In [2]:
print(True and False)
False
In [3]:
print(False and False)
False
blue_trail_and.py
¶
🖌 or
¶
In [4]:
print(True or True)
True
In [5]:
print(True or False)
True
In [6]:
print(False or False)
False
🎨 🖌 Complex logic¶
cross_the_pond.py
¶
The green squares above blue are lilypads. They don't jump away as Bit passes by.
The red squares above black are flowers. They don't jump either.
The green squares above black is a frog. It will jump if Bit passes by.
Move Bit to the other side of the pond and clear the frogs.
🐸
Freedom¶
When you hear
Move until condition is true
Think
while not condition:
bit.move()
Spiral 🧑🏻🎨¶
Hurdles 👩🏼🎨¶
Key Ideas¶
return
and
,or
- Writing functions for complex logical statements